import { ZUSTAND_STORAGE } from '@/zustand'
import { create } from 'zustand'
import { persist } from 'zustand/middleware'

/** 👇 存储 token 👇 */
const useLayoutConfig = create<ZUSTAND.ILayoutConfig>()(
  persist(
    (set) => ({
      isFixed: false,
      setIsFixed: (isFixed) => set(() => ({ isFixed })),
      waterMark: '',
      setWaterMark: (waterMark) => set(() => ({ waterMark })),
      themeMode: 'light',
      setThemeMode: (themeMode) => set(() => ({ themeMode })),
      themeConfig: {},
      setThemeConfig: (themeConfig) => set(() => ({ themeConfig })),
    }),
    { storage: ZUSTAND_STORAGE, name: 'zustand_layout_config' }
  )
)

export default useLayoutConfig
